package com.itheima.sh.web;

import com.itheima.sh.pojo.User;
import com.itheima.sh.service.UserServiceImpl;

@javax.servlet.annotation.WebServlet("/reisterServlet")
public class ReisterServlet extends javax.servlet.http.HttpServlet {
    protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {
        doGet(request, response);
    }

    protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {
        request.setCharacterEncoding("utf-8");
        String username = request.getParameter("username");
        String pwd = request.getParameter("password");
        User user=new User();
        user.setUsername(username);
        user.setPassword(pwd);
        UserServiceImpl userService = new UserServiceImpl();
        boolean u=userService.register(user);
        response.getWriter().print(u);
    }
}